<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        li:nth-child(2n){
            /* 证明n从1开始的 */
            color: #ff0000;
        }
    </style>
</head>
<body>
    <div>
        <div>
            <ol>
                <li>小孙快起来吧</li>
                <li>小孙快起来吧</li>
                <li>小孙快起来吧</li>
                <li>小孙快起来吧</li>
                <li>小孙快起来吧</li>
            </ol>
        </div>

    </div>
    <script>
        let arr = ["ab","abcgaji","abcahsi"]
        function test(a,b){
            let i = 0
            let res = ''
            while(i<a.length&&i<b.length){
                if(a[i]==b[i]){
                   res += a[i]
                   i++
                }else{
                    break
                }
            }
            return res
        }
       let result =  test(arr[0],arr[1])
       for(let i=2;i<arr.length;i++){
        if(result==''){
              console.log('')
              break
           }
           result = test(arr[i],result)
       }
       console.log(result)
    </script>
</body>
</html>